// pages/datalis/datalis.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    calassList:[
        {name:"STARS",
        term:[
            {
              "image": "../imageidol/1.png",
              "title": "樱木",
              "pickup": false,
              "introduce": "美女",
              "price": "さくらぎ まの",
              "interestin": "与人交谈、活动身体",
              "specialeffects": "运动全能",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"1"
          },
          {
              "image": "../imageidol/2.png",
              "title": "风野灯织",
              "pickup": false,
              "introduce": "美女",
              "interestin": "外出、公园晒太阳",
              "specialeffects": "被鸟喜欢",
              "price": "かざの ひおり",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"2"
          },
          {
              "image": "../imageidol/3.png",
              "title": "八宮巡",
              "pickup": true,
              "introduce": "美女",
              "interestin": "音乐鉴赏、探寻美景、占卜",
              "specialeffects": "料理、日程管理",
              "price": "はちみや めぐる",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"3"
          },
          {
              "image": "../imageidol/1.png",
              "title": "樱木",
              "pickup": false,
              "introduce": "美女",
              "interestin": "与人交谈、活动身体",
              "specialeffects": "运动全能",
              "price": "さくらぎ まの",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"1"
          },
          {
              "image": "../imageidol/2.png",
              "title": "风野灯织",
              "pickup": false,
              "introduce": "美女",
              "price": "かざの ひおり",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"2"
          },
          {
              "image": "../imageidol/3.png",
              "title": "八宮巡",
              "pickup": true,
              "introduce": "美女",
              "price": "はちみや めぐる",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"3"
          },  {
              "image": "../imageidol/1.png",
              "title": "樱木真乃",
              "pickup": false,
              "introduce": "美女",
              "price": "さくらぎ まの",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"4"
          },
          {
              "image": "../imageidol/2.png",
              "title": "风野灯织",
              "pickup": false,
              "introduce": "美女",
              "price": "かざの ひおり",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"5"
          },
          {
              "image": "../imageidol/3.png",
              "title": "八宮巡",
              "pickup": true,
              "introduce": "美女",
              "price": "はちみや めぐる",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"6"
          },
          ]
        },
        {
          name:"Antica",
          term:[
              {
                "image": "../imageidol/4.png",
                "title": "月冈恋钟",
                "pickup": false,
                "xuangaoyu": "我想像暖呼呼的太陽一樣，為粉絲們送上笑容。",
                "introduce": "美女",
                "price": "つきおか こがね",
                "norms": {
                    "weight": "500g",
                    "prime": "6"
                },
                "id":"7"
            },
            {
                "image": "../imageidol/5.png",
                "title": "田中摩美美",
                "xuangaoyu": "我想像暖呼呼的太陽一樣，為粉絲們送上笑容。",
                "pickup": false,
                "introduce": "美女",
                "price": "たなか まみみ",
                "norms": {
                    "weight": "200g",
                    "prime": "4"
                },
                "id":"8"
            },
            {
                "image": "../imageidol/6.png",
                "title": "白濑咲耶",
                "pickup": false,
                "introduce": "美女",
                "price": "しらせ さくや",
                "norms": {
                    "weight": "500g",
                    "prime": "7"
                },
                "id":"9"
            },
            {
                "image": "../imageidol/7.png",
                "title": "三峰结华",
                "pickup": true,
                "introduce": "美女",
                "price": "みつみね ゆいか",
                "discount": "27.99",
                "norms": {
                    "weight": "450g",
                    "prime": "5"
                },
                "id":"10"
            },
            {
              "image": "../imageidol/8.png",
              "title": "幽谷雾子",
              "pickup": true,
              "introduce": "美女",
              "price": "ゆうこく きりこ",
              "discount": "27.99",
              "norms": {
                  "weight": "450g",
                  "prime": "5"
              },
              "id":"11"
          },
          {
              "image": "../imageidol/4.png",
              "title": "月冈恋钟",
              "pickup": false,
              "introduce": "美女",
              "price": "つきおか こがね",
              "norms": {
                  "weight": "500g",
                  "prime": "6"
              },
              "id":"12"
          },
          {
              "image": "../imageidol/5.png",
              "title": "田中摩美美",
              "pickup": false,
              "introduce": "美女",
              "price": "たなか まみみ",
              "norms": {
                  "weight": "200g",
                  "prime": "4"
              },
              "id":"13"
          },
          {
              "image": "../imageidol/6.png",
              "title": "白濑咲耶",
              "pickup": false,
              "introduce": "美女",
              "price": "しらせ さくや",
              "norms": {
                  "weight": "500g",
                  "prime": "7"
              },
              "id":"14"
          },
          {
              "image": "../imageidol/7.png",
              "title": "三峰结华",
              "pickup": true,
              "introduce": "美女",
              "price": "みつみね ゆいか",
              "discount": "27.99",
              "norms": {
                  "weight": "450g",
                  "prime": "5"
              },
              "id":"15"
          },
          {
            "image": "../imageidol/8.png",
            "title": "幽谷雾子",
            "pickup": true,
            "introduce": "美女",
            "price": "ゆうこく きりこ",
            "discount": "27.99",
            "norms": {
                "weight": "450g",
                "prime": "5"
            },
            "id":"16"
        }
          ]
        },
        {
          name:'放課後',
          term:[
              {
                "image": "../imageidol/9.png",
                "title": "小宫果穗",
                "pickup": true,
                "introduce": "美女",
                "price": "こみや かほ",
                "discount": "17.99",
                "norms": {
                    "weight": "450g",
                    "prime": "5"
                },
                "id":"17"
            },
            {
                "image": "../imageidol/10.png",
                "title": "园田智代子",
                "pickup": false,
                "introduce": "美女",
                "price": "そのだ ちよこ",
                "norms": {
                    "weight": "500g",
                    "prime": "6"
                },
                "id":"18"
            },
            {
                "image": "../imageidol/11.png",
                "title": "西城树里",
                "pickup": true,
                "introduce": "美女",
                "price": "さいじょう じゅり",
                "discount": "22.99",
                "norms": {
                    "weight": "250g",
                    "prime": "4"
                },
                "id":"19"
            },
            { "image": "../imageidol/12.png",
                "title": "杜野凛世",
                "pickup": false,
                "introduce": "美女",
                "price": "もりの りんぜ",
                "norms": {
                    "weight": "100g",
                    "prime": "5"
                },
                "id":"20"
            },
            { "image": "../imageidol/13.png",
            "title": "有栖川夏叶",
            "pickup": false,
            "introduce": "美女",
            "price": "ありすがわ なつは",
            "norms": {
                "weight": "100g",
                "prime": "5"
            },
            "id":"21"
        },
        {
          "image": "../imageidol/9.png",
          "title": "小宫果穗",
          "pickup": true,
          "introduce": "美女",
          "price": "こみや かほ",
          "discount": "17.99",
          "norms": {
              "weight": "450g",
              "prime": "5"
          },
          "id":"22"
      },
      {
          "image": "../imageidol/10.png",
          "title": "园田智代子",
          "pickup": false,
          "introduce": "美女",
          "price": "そのだ ちよこ",
          "norms": {
              "weight": "500g",
              "prime": "6"
          },
          "id":"23"
      },
      {
          "image": "../imageidol/11.png",
          "title": "西城树里",
          "pickup": true,
          "introduce": "美女",
          "price": "さいじょう じゅり",
          "discount": "22.99",
          "norms": {
              "weight": "250g",
              "prime": "4"
          },
          "id":"24"
      },
      { "image": "../imageidol/12.png",
          "title": "杜野凛世",
          "pickup": false,
          "introduce": "美女",
          "price": "もりの りんぜ",
          "norms": {
              "weight": "100g",
              "prime": "5"
          },
          "id":"25"
      },
      { "image": "../imageidol/13.png",
      "title": "有栖川夏叶",
      "pickup": false,
      "introduce": "美女",
      "price": "ありすがわ なつは",
      "norms": {
          "weight": "100g",
          "prime": "5"
      },
      "id":"26"
  }
          ]
        },
        {name:"EMERIA队",
        term:[
            {
              "image": "../imageidol/14.png",
              "title": "动大崎甘奈漫",
              "pickup": false,
              "introduce": "美女",
              "price": "おおさき あまな",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"27"
          },
          {
              "image": "../imageidol/16.png",
              "title": "桑山千雪",
              "pickup": false,
              "introduce": "美女",
              "price": "わやま ちゆき",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"28"
          },
          {
              "image": "../imageidol/15.png",
              "title": "大崎甜花",
              "pickup": true,
              "introduce": "美女",
              "price": "おおさき てんか",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"29"
          },
          {
              "image": "../imageidol/14.png",
              "title": "动大崎甘奈漫",
              "pickup": false,
              "introduce": "美女",
              "price": "おおさき あまな",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"30"
          },
          {
              "image": "../imageidol/16.png",
              "title": "桑山千雪",
              "pickup": false,
              "introduce": "美女",
              "price": "わやま ちゆき",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"31"
          },
          {
              "image": "../imageidol/15.png",
              "title": "大崎甜花",
              "pickup": true,
              "introduce": "美女",
              "price": "おおさき てんか",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"32"
          },
          ]
        },{name:"Stray",
        term:[
            {
              "image": "../imageidol/17.png",
              "title": "芹泽朝日",
              "pickup": false,
              "introduce": "美女",
              "price": "せりざわ あさひ",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"33"
          },
          {
              "image": "../imageidol/18.png",
              "title": "黛冬优子",
              "pickup": false,
              "introduce": "美女",
              "price": "まゆずみ ふゆこ",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"34"
          },
          {
              "image": "../imageidol/19.png",
              "title": "和泉爱依",
              "pickup": true,
              "introduce": "美女",
              "price": "いずみ めい",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"35"
          },
          {
              "image": "../imageidol/17.png",
              "title": "芹泽朝日",
              "pickup": false,
              "introduce": "美女",
              "price": "せりざわ あさひ",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"36"
          },
          {
              "image": "../imageidol/18.png",
              "title": "黛冬优子",
              "pickup": false,
              "introduce": "美女",
              "price": "まゆずみ ふゆこ",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"37"
          },
          {
              "image": "../imageidol/19.png",
              "title": "和泉爱依",
              "pickup": true,
              "introduce": "美女",
              "price": "いずみ めい",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"38"
          },
          ]
        },{name:"noctch",
        term:[
            {
              "image": "../imageidol/20.png",
              "title": "浅仓透",
              "pickup": false,
              "introduce": "美女",
              "price": "あさくら とおる",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"39"
          },
          {
              "image": "../imageidol/21.png",
              "title": "樋口圆香",
              "pickup": false,
              "introduce": "美女",
              "price": "かざの ひおり",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"40"
          },
          {
              "image": "../imageidol/22.png",
              "title": "福丸小糸",
              "pickup": true,
              "introduce": "美女",
              "price": "ふくまる こいと",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"41"
          },
          {
              "image": "../imageidol/23.png",
              "title": "市川雏菜",
              "pickup": true,
              "introduce": "美女",
              "price": "いちかわ ひなな",
              "discount": "5.59",
              "norms": {
                  "weight": "500g",
                  "prime": "6"
              },
              "id":"42"
          },
          {
              "image": "../imageidol/20.png",
              "title": "浅仓透",
              "pickup": false,
              "introduce": "美女",
              "price": "あさくら とおる",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"43"
          },
          {
              "image": "../imageidol/21.png",
              "title": "樋口圆香",
              "pickup": false,
              "introduce": "美女",
              "price": "かざの ひおり",
              "norms": {
                  "weight": "600g",
                  "prime": "7"
              },
              "id":"44"
          },
          {
              "image": "../imageidol/22.png",
              "title": "福丸小糸",
              "pickup": true,
              "introduce": "美女",
              "price": "ふくまる こいと",
              "discount": "4.60",
              "norms": {
                  "weight": "250g",
                  "prime": "5"
              },
              "id":"45"
          },
          {
              "image": "../imageidol/23.png",
              "title": "市川雏菜",
              "pickup": true,
              "introduce": "美女",
              "price": "いちかわ ひなな",
              "discount": "5.59",
              "norms": {
                  "weight": "500g",
                  "prime": "6"
              },
              "id":"46"
          }
          ]
        },{name:"SHHis",
        term:[
            {
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"47"
          },
          {
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"48"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"49"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"50"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"51"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"52"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"53"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"54"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"55"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"56"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"57"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"58"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"59"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"60"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"61"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"62"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"63"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"64"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"65"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"66"
          },{
              "image": "../imageidol/24.png",
              "title": "七草日花",
              "pickup": false,
              "introduce": "美女",
              "price": "ななくさ にちか",
              "norms": {
                  "weight": "500g",
                  "prime": "2"
              },
              "id":"67"
          },
          ]
        },
      ],
      id:'',
      index:'',
      itemlist:[]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      // console.log(options);
      this.setData({
        id:options.id,
        index:options.index
      })
      this.getitemlist()
  },
  getitemlist(){
    let _this = this
    //获取对应分类的数据
      let items = this.data.calassList[this.data.index].term
        // console.log(items);
        let item = items.filter(function(v){
              if(_this.data.id===v.id){
                _this.setData({
                    itemlist:v
                  })
              }
        })
    },
    handletcar(){
        // console.log("ok")
        // 获取缓存中的值
        let car=wx.getStorageSync("car")||[];
        // 判断缓存中是否已有该商品
        let index=car.findIndex(v=>v.id===this.data.itemlist.id)
        // console.log("index");
        if(index===-1){
            // 没有添加过改商品
            this.data.itemlist.num=1
            car.push(this.data.itemlist)
            wx.showToast({
                title: '关注成功',
                icon: 'none',
                // image: '',
                // duration: 1500,
                icon:"success",
                mask: true,
            });
              
        }else{
            // 已经添加过该商品
            car[index].num++
            wx.showToast({
                title: '关注成功',
                icon: 'none',
                // image: '',
                // duration: 1500,
                icon:"success",
                mask: true,
            });
        }
        // 存
        wx.setStorageSync("car", car); 
    },
    handletcar2(){
        wx.switchTab({
            url: '/pages/demo02/demo02'
        });
          

    }
    
  
})